-
Notifications
You must be signed in to change notification settings - Fork 22
Add Full Horizon (V2) TAP Receipt Verifier Support #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
neithanmo
wants to merge
58
commits into
main
Choose a base branch
from
feat/horizon
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fix the TODO comment about mapping allocation types - now properly detects Horizon contracts and maps allocations accordingly instead of always using Legacy type
…able context Enhance RAV request error messages to indicate which receipt table (V1/Legacy vs V2/Horizon) was queried, helping with Horizon migration debugging
…acking Add comprehensive debug and info logging throughout the allocation and escrow account systems to improve troubleshooting of receipt processing, RAV generation, and Horizon migration issues.
- Reduce timestamp buffer from 1000s to 30s for faster RAV generation - Add trigger_value_divisor configuration for fine-tuned receipt batching - Set max_receipt_value_grt to 0.001 for controlled testing - Update tap-aggregator endpoint port configuration
7a60956
to
4c6e510
Compare
Add dual domain separator support for V1 (TAP) and V2 (GraphTally) protocols. This enables simultaneous processing of both legacy and Horizon receipt types with version-appropriate EIP712 domains
Update service components to support both V1 and V2 domain separators simultaneously. Includes IndexerTapContext, ServiceRouter, and middleware updates for version-aware receipt processing.
Critical fix for V2 receipt processing failures. Store receipts using version-appropriate domain separators to ensure correct signer recovery and escrow account lookup. Resolves "signer not found in V2 escrow accounts" errors.
Implement version-aware receipt authorization that routes V1 and V2 receipts to appropriate TAP managers. Includes new dual_tap_receipt_authorize function for simultaneous protocol support.
Update sender middleware to use version-appropriate domain separators for signer recovery. V1 receipts use legacy domain, V2 receipts use Horizon domain for correct escrow account lookups.
Add V2 domain separator support to sender account management, allocation handling, and receipt processing. Maintains single allocation type invariant while enabling version-appropriate domain usage.
Update receipt validation checks and test infrastructure to support dual domain separators. Ensures proper EIP712 domain usage for both V1 and V2 receipt types in testing scenarios.
Update integration tests, TAP agent tests, and service router tests to support V1/V2 dual domain architecture. Ensures comprehensive testing coverage for both protocol versions.
- Add optional receipts_verifier_address_v2 to BlockchainConfig - Update configuration examples with V2 verifier documentation - Prepare infrastructure for dual domain separator support
- Update indexer-service and tap-agent to use correct V2 verifier addresses - Add strict validation: V2 address required when horizon.enabled=true - Implement graceful fallback when Horizon is disabled
- Remove static config.toml files from indexer-service and tap-agent - Update Dockerfiles to rely on start.sh for dynamic config generation - Clean up docker-compose.dev.yml by removing commented static config mounts - Ensure consistent contract file mounting across all Docker configurations
feat(sender_account): Propagate new subgraph_service_address to receipt layers fix(horizon): use subgraph_service in query for V2 receipts
…ionId check - Accept Horizon (V2) receipts that only provide collection_id by mapping the 32‑byte value to an Address (last 20 bytes, right‑aligned). - Preserve V1 behavior (use allocation_id() when present). - Validate collection_id length and return a clear error when invalid. - Add a small debug log comparing the resolved allocation_id to the expected one.
5aaeab9
to
e186490
Compare
- Add TestConfig struct with env-backed configuration - Add env_loader module for loading test environment variables This centralizes test configuration and makes it easier to run tests against different environments without hardcoding values.
- Replace metrics-based checking with direct database state verification - Update test_tap_rav_v2 to use TestConfig and DatabaseChecker - Add detailed state tracking with pending receipt values - Add timeout-based RAV creation waiting with diagnostic output
…ging - Remove test_direct_service_rav_v2_simplified (299 lines) - Clean up debug logging in find_allocation function - Remove commented code and update function references in main.rs
- Extend Docker health check timeouts from 30s to 120s - Add HTTP endpoint verification for indexer-service and tap-agent - Override allocation ID with known test value for consistency - Add 10s wait for indexer chain synchronization - Add optional pgAdmin startup for debugging
…return Result from start_agent - Enforce hard startup error when horizon.enabled = true but Horizon isn’t active in the Network Subgraph (no silent fallback to V1). - Error out if the Horizon readiness query fails (subgraph/network error) instead of proceeding. - Convert start_agent to return anyhow::Result<(ActorRef<…>, JoinHandle<…>)> and propagate errors in main. - Add contextual errors for watcher initialization and actor spawn (replace .expect(...) with .with_context(...)?).
…ployed Previously, both tap-agent and indexer-service would silently fall back to legacy (V1) mode when horizon.enabled=true but Horizon contracts weren't found in the network subgraph. This could lead to silent misconfigurations where operators expected V2 functionality but got V1. Changes: - tap-agent: Replace silent fallback with anyhow::bail! on missing contracts - indexer-service: Replace silent fallback with anyhow::bail! on missing contracts - Both services now fail at startup with clear error messages explaining: - How to disable Horizon (set horizon.enabled=false) - How to fix it (deploy Horizon contracts to network) - Replace .expect() calls with .with_context() for better error handling
e186490
to
3928a0b
Compare
…pport - Add version-specific counters and gauges for unaggregated fees, RAV creation/failures, and response times - Introduce `*_by_version` metrics with TAP version labels (v1/v2) - Maintain backward compatibility by preserving legacy metrics for V1 only - Add helper function `get_tap_version()` using type introspection to determine TAP version - Support monitoring of dual V1/V2 protocol operations during migration
Replace horizon_enabled boolean and optional subgraph_service_address fields with a TapMode enum that encapsulates TAP version modes. - Add TapMode enum with Legacy and Horizon variants - Legacy mode: V1 TAP receipts only - Horizon mode: hybrid V1/V2 support with SubgraphService address - Update all references from horizon_enabled to tap_mode.is_horizon() - Replace direct subgraph_service_address access with pattern matching - Add helper methods: is_legacy(), supports_v2(), v1_only() - Update TapAgentContext to use Option<Address> for SubgraphService - Add comprehensive documentation with usage examples This improves type safety by ensuring SubgraphService address is only accessible when actually configured for Horizon mode.
… contexts The Horizon (V2) TAP receipt and RAV database queries require a subgraph_service_address to filter records by the data_service field. Test contexts were not providing this address, causing Horizon tests to fail with "SubgraphService address not available" errors. Changes: - Set subgraph_service_address in all Horizon TapAgentContext builders for tests - Update Horizon test receipt/RAV creation to use consistent data_service addresses - Ensure V2 receipts use TAP_SENDER.1 as data_service to match query expectations
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements comprehensive support for Horizon (V2) TAP receipts by adding dual domain separator configuration and proper V2 verifier address handling across all services. This completes the foundation for full Horizon migration support in the indexer-rs ecosystem.
Changes Made
Configuration Updates
receipts_verifier_address_v2
field toBlockchainConfig
for separate V2 contract addressesService Updates
indexer-service
to use correct V2 verifier address for domain separator creationtap-agent
to use correct V2 verifier address for global domain separatorshorizon.enabled = true
,receipts_verifier_address_v2
must be explicitly configured (fails fast with clear error)horizon.enabled = false
, V2 operations fall back to V1 verifier address if V2 isn't specifiedInfrastructure Updates
Key Behavioral Changes
Horizon Configuration Invariants
When
horizon.enabled = true
: Both services require explicit V2 verifier configuration and will fail fast with:When
horizon.enabled = false
: Both services gracefully fall back to V1 addresses for V2 domainsDomain Separator Logic
receipts_verifier_address
receipts_verifier_address_v2
(required)receipts_verifier_address_v2
or fallback toreceipts_verifier_address
Configuration Example
Impact
This change resolves the "No sender found for signer" errors that occurred when V2 receipts were validated against incorrect verifier contracts. The dual domain approach ensures:
Testing